package com.loongtech.bi.action.business;

import java.util.List;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.loongtech.bi.action.BaseBiSearchAction;
import com.loongtech.bi.manager.business.ReconciliationBusinessChannelManager;
import com.loongtech.bi.manager.business.ReconciliationBusinessChannelManager.BusinessDataChannel;
import com.loongtech.bi.manager.system.GameParamConfigManager;
import com.loongtech.bi.manager.system.SysLogManager;
import com.loongtech.bi.support.CommonGameParam;
import com.loongtech.bi.support.Session;

/**
 * 账务工具—对帐查询Action
 * @author Marin
 * @date 2015年09月17日
 */
@Controller
@Scope("view")
public class ReconciliationBusinessChannelAction extends BaseBiSearchAction {
	private static final long serialVersionUID = 1L;
	private List<BusinessDataChannel> dataList1;  // 获得汇总数据
	private List<BusinessDataChannel> dataList2;  // 获得详细数据
	
	@Autowired
	private SysLogManager sysLogManager;
	@Autowired
	private Session session;
	
	@Autowired
	private ReconciliationBusinessChannelManager reconciliationBusinessChannelManager;
	
	@PostConstruct
	public void init() {
		search();
	}

	public void search() {
		sysLogManager.addLog(session.getUserName(), "账务工具—对帐查询");
		//汇总数据
		dataList1 = reconciliationBusinessChannelManager.getBusinessSumData(dateStart, dateEnd);
		dataList2 = reconciliationBusinessChannelManager.getBusinessDetailData(dateStart, dateEnd);
	}
	
	//WEB直充
	public String getWebZhiChong() {
		return (String) GameParamConfigManager.getItemsRevise(CommonGameParam.WEBZHICHONG).keySet().toArray()[1];
	}
	
	@Override
	protected String csvContent() {
		return "对账查询";
	}

	@Override
    protected String csvFileName() {
	    return "对账查询";
    }

	public List<BusinessDataChannel> getDataList1() {
		return dataList1;
	}

	public void setDataList1(List<BusinessDataChannel> dataList1) {
		this.dataList1 = dataList1;
	}

	public List<BusinessDataChannel> getDataList2() {
		return dataList2;
	}

	public void setDataList2(List<BusinessDataChannel> dataList2) {
		this.dataList2 = dataList2;
	}
}
